import request from '@/utils/request.js'

const prefix = '/api/circle'

// 帖子列表
export function circleList(params) {
	return request({
		url: prefix + '/list',
		method: 'get',
		params: params
	})
}

// 发布帖子
export function circleAdd(data) {
	return request({
		url: prefix + '/add',
		method: 'post',
		data: data
	})
}
/**
 * 点赞
 * @param {Object} id
 */
export function addZan(id) {
	return request({
		url: prefix + '/addZan/'+id,
		method: 'post',
	})
}
/**
 * 帖子详情
 * @param {Object} id
 */
export function circleInfo(id) {
	return request({
		url: prefix + '/info/'+id,
		method: 'get',
	})
}
/**
 * 删除帖子
 * @param {Object} id
 */
export function circleDel(id) {
	return request({
		url: prefix + '/remove/'+id,
		method: 'post',
	})
}
/**
 * 修改帖子
 */
export function circleEdit(data) {
	return request({
		url: prefix + '/edit',
		method: 'post',
		data: data
	})
}


//关注
export function addInterest(userId) {
	return request({
		url: prefix + '/interest/' + userId,
		method: 'post'
	})
}
//取消关注
export function cancelInterest(userId) {
	return request({
		url: prefix + '/delInterest/' + userId,
		method: 'delete'
	})
}

